package com.sniservices.test;

/**
 * Created by Shaine Ismail.
 * User: sismail
 * Date: 19/06/2011
 * Time: 08:40
 * Copyright SNI-Services ltd
 */
public class PeekABoo implements Calculation{

    private static final String DIVISIBLE_BY_THREE = "Peek";
    private static final String DIVISIBLE_BY_FIVE = "Boo";

    private static final String DIVISIBLE_BY_THREE_AND_FIVE = DIVISIBLE_BY_THREE + " a "+DIVISIBLE_BY_FIVE ;

    @Override
    public String calculateAnReturnString(int value) {
        if ( divisibleBy3( value ) && divisibleBy5( value)){
            return DIVISIBLE_BY_THREE_AND_FIVE;
        }else if (divisibleBy3(value)){
            return DIVISIBLE_BY_THREE;
        }else if (divisibleBy5(value)){
            return DIVISIBLE_BY_FIVE;
        }else{
            return Integer.toString(value);
        }

    }

    protected boolean divisibleBy3(int value){
        return value % 3 == 0;
    }


    protected boolean divisibleBy5(int value){
        return value % 5 == 0;
    }
}
